﻿/*
	wp8libflac project
	© Alovchin, 2014
*/

#pragma once

using namespace Platform;

INTEROP_NAMESPACE_BEGIN

/// <summary>
/// Describes FLAC stream info.
/// </summary>
public ref class FlacStreamInfo sealed
{
internal:
	FlacStreamInfo(double duration, int64 avgBytesPerSec, int64 streamLength) :
		m_duration(duration),
		m_avgBytesPerSec(avgBytesPerSec),
		m_streamLength(streamLength)
	{
	}

public:
	property double Duration
	{
		double get() { return this->m_duration; }
	}

	property int64 BytesPerSecond
	{
		int64 get() { return this->m_avgBytesPerSec; }
	}

	property int64 StreamLength
	{
		int64 get() { return this->m_streamLength; }
	}

#if USE_WAVEHEADER
	
	property Array<uint8> ^WaveHeader
	{
		Array<uint8> ^get() { return const_cast<Array<uint8> ^>(this->m_waveHeader); }
	internal:
		void set(const Array<uint8> ^value) { this->m_waveHeader = value; }
	}

#endif

	property uint32 BitsPerSample
	{
		uint32 get() { return this->m_bitsPerSample; }
	internal:
		void set(uint32 value) { this->m_bitsPerSample = value; }
	}

#if USE_CODECDATA

	property String ^CodecData
	{
		String ^get() { return this->m_codecData; }
	internal:
		void set(String ^value) { this->m_codecData = value; }
	}

#else

	property uint32 SampleRate
	{
		uint32 get() { return this->m_sampleRate; }
	internal:
		void set(uint32 value) { this->m_sampleRate = value; }
	}

	property uint32 ChannelCount
	{
		uint32 get() { return this->m_channelCount; }
	internal:
		void set(uint32 value) { this->m_channelCount = value; }
	}

#endif

private:
#if USE_WAVEHEADER
	const Array<uint8> ^m_waveHeader;
#endif

	double	m_duration;
	int64	m_avgBytesPerSec;
	int64	m_streamLength;
	uint32	m_bitsPerSample;

#if USE_CODECDATA
	String	^m_codecData;
#else
	uint32	m_sampleRate;
	uint32	m_channelCount;
#endif	
};

INTEROP_NAMESPACE_END
